package cn.flying.cloud.gen;

import java.util.ArrayList;
import java.util.List;

import cn.flying.cloud.tool.code.service.GenerateCodeService;
import cn.flying.cloud.tool.vo.GenerateConfig;

/**
 * @author: admin
 * @date: 2023年08月23日 22:05
 * @version: 1.0
 */
public class ConsoleGenMain {
    public static void main(String[] args) throws Exception {
        //生成单表
//        singleTable();

        // 生成多表
        multipleTable();
    }

    private static void singleTable() throws Exception {
        GenerateCodeService service = new GenerateCodeService();

        GenerateConfig config = new GenerateConfig();
        config.setType("MySql");
        config.setName("db_file");
        config.setHost("8.137.118.100");
//        config.setHost("localhost");
        config.setPort("3306");
        config.setUsername("root");
        config.setPassword("Rot132231,.");
//        config.setPassword("root123456");
        config.setAuthor("admin");
        config.setParent("cn.flying.cloud");
        config.setModuleName("file");
        config.setTableName("oss_config");
        config.setPrefix("");

        service.generateMpStyleCode(config);
//        service.generateMbStyleCode(config);
    }

    private static void multipleTable() {
        GenerateCodeService service = new GenerateCodeService();

        GenerateConfig config = new GenerateConfig();
        config.setType("MySql");
        config.setName("db_admin");
        config.setHost("8.137.118.100");
//        config.setHost("localhost");
        config.setPort("3306");
        config.setUsername("root");
        config.setPassword("Rot132231,.");
//        config.setPassword("root123456");
        config.setAuthor("admin");
        config.setParent("cn.flying.cloud");
        config.setModuleName("system.log");
        List<String> tableNames = new ArrayList<>();
//        tableNames.add("sys_area_info");
//        tableNames.add("sys_login_log");
        tableNames.add("sys_oper_log");
        config.setTableNames(tableNames);

        service.generateMpStyleCode(config);
    }

}
